<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="http://localhost:8080/CSS/login.css"/>
</head>
<body>
<div class="body_div">
    <img src="http://localhost:8080/images/logo_touming.gif" width="200" height="65">
    <img src="http://localhost:8080/images/logotxt.png" >
    <div class="body_bor">
        <h2 style="color: white; text-align: center; line-height: 30px;">欢迎使用本平台</h2>
        <form action="/" method="post" enctype="application/x-www-form-urlencoded">
            <p class="mtop">
                <label>账号：</label>
                <input type="text" placeholder="请输入员工账号" name="uid" />
            </p>
            <p>
                <label>密码：</label>
                <input type="password" placeholder="请输入员工密码" name="pwd" id="pwd" />
                <img src="http://localhost:8080/images/close.png" alt="" id="eye" class="img">
            </p>
            <div>
                <select class="select" name="select">
                    <option disabled="disabled">请选择</option>
                    <option value ="1" selected="selected">普通员工</option>
                    <option value ="2">行政主管</option>
                    <option value ="3">财务总监</option>
                </select>
            </div>
            <div class="check">
                <input type="checkbox" id="check" />
                <label style="color: white;">我已阅读并同意<a href="javascript:;" style="text-decoration: none;">条约</a></label>
            </div>
            <p>
                <input type="submit" value="登录" class="btn" id="sub" />
            </p>
        </form>
    </div>
</div>
</body>
</html>
<script type="text/javascript">
    var sub = document.getElementById('sub');
    var check = document.getElementById('check');

    //1.获取元素
    var eye = document.getElementById('eye');
    var pwd = document.getElementById('pwd');
    //2.注册事件    处理程序
    var flag = 0;
    eye.onclick = function() {
        //点击一次，flag一定变化
        if (flag == 0) {
            pwd.type = 'text';
            eye.src = 'http://localhost:8080/images/open.png';
            flag = 1; //赋值操作
        } else {
            pwd.type = 'password';
            eye.src = 'http://localhost:8080/images/close.png';
            flag = 0;
        }

    }

    //console.log(check.checked)
    sub.onclick = function(){
        if(!check.checked){
            alert('请勾选同意条款')
            return false;
        }
    }
</script>

